//
//  YouLikeView.h
//  jingdong
//
//  Created by 陈明光 on 2021/7/25.
//  Copyright © 2021 陈明光. All rights reserved.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
@protocol DBYScrollViewDataSource;
@protocol DBYScrollViewDelegate;
@interface YouLikeView : UIView
@property (assign,nonatomic) NSInteger currentPage;
@property (assign,nonatomic) BOOL scrollEnabled;//default is YES
@property (assign,nonatomic) BOOL cycleEnabled;//是否可循环滚动，default is YES
@property (weak,nonatomic) id<DBYScrollViewDataSource> dataSource;
@property (weak,nonatomic) id<DBYScrollViewDelegate> delegate;

-(id)dequeueReusableView;//重用池中取出一个控件
-(void)reloadData;
@end
@protocol DBYScrollViewDataSource<NSObject>
/*!
 *    @brief    获取数据源，要注意的是，使用dequeueReusableView进行获取，如果返回为nil，则再进行创建，类似tableView早前的数据获取方式。
 *
 *    @param     pageIndex     第几页
 *
 *    @return    要展示的控件
 */
-(UIView*)viewForDBYScrollView:(YouLikeView*)adScrollView atPage:(NSInteger)pageIndex;
-(NSUInteger)numberOfViewsForDBYScrollView:(YouLikeView*)adScrollView;
@end

@protocol DBYScrollViewDelegate<NSObject>
-(void)adScrollView:(YouLikeView*)adScrollView didClickedAtPage:(NSInteger)pageIndex;
-(void)adScrollView:(YouLikeView*)adScrollView didScrollToPage:(NSInteger)pageIndex;
@end
NS_ASSUME_NONNULL_END
